home *** CD-ROM | disk | FTP | other *** search
- /*
- File: Multiprocessing.h
-
- Contains: Multiprocessing interfaces
-
- Version: Technology: System 8
- Release: Universal Interfaces 3.0d3 on Copland DR1
-
- Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
-
- Bugs?: If you find a problem with this file, send the file and version
- information (from above) and the problem description to:
-
- Internet: apple.bugs@applelink.apple.com
- AppleLink: APPLE.BUGS
-
- */
- #ifndef __MULTIPROCESSING__
- #define __MULTIPROCESSING__
-
- #ifndef __TYPES__
- #include <Types.h>
- #endif
- #ifndef __CODEFRAGMENTS__
- #include <CodeFragments.h>
- #endif
- #ifndef __KERNEL__
- #include <Kernel.h>
- #endif
- #ifndef __TIMING__
- #include <Timing.h>
- #endif
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #if PRAGMA_IMPORT_SUPPORTED
- #pragma import on
- #endif
-
- #if PRAGMA_ALIGN_SUPPORTED
- #pragma options align=power
- /* the following contents can only be used by compilers that support PowerPC struct alignment */
-
- #if FOR_SYSTEM7_ONLY
- typedef struct OpaqueMPTaskID* MPTaskID;
- typedef struct OpaqueMPQueueID* MPQueueID;
- typedef UInt32 MPTaskOptions;
- typedef OSStatus (*TaskProc)(void *parameter);
-
- enum {
- kDurationImmediate = 0L,
- kDurationForever = 0x7FFFFFFF
- };
-
- #endif
- #if FOR_SYSTEM8_PREEMPTIVE
- typedef TaskID MPTaskID;
- typedef KernelQueueID MPQueueID;
- typedef TaskOptions MPTaskOptions;
- #endif
- #if FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE
- typedef struct OpaqueMPSemaphoreID* MPSemaphoreID;
- typedef struct OpaqueMPCriticalRegionID* MPCriticalRegionID;
- typedef UInt32 MPSemaphoreCount;
-
- enum {
- kMPNoID = kInvalidID
- };
-
- #endif
- #if FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE
- #define MPLibraryIsLoaded() ((UInt32)MPCreateTask != (UInt32)kUnresolvedCFragSymbolAddress)
- extern UInt32 MPProcessors(void );
-
- extern OSStatus MPCreateTask(TaskProc taskEntryPoint, void *taskParameter, ByteCount stackSize, MPQueueID notifyQ, void *notifyParameter1, void *notifyParameter2, MPTaskOptions options, MPTaskID *newTask);
-
- extern OSStatus MPTerminateTask(MPTaskID task, OSStatus terminationStatus);
-
- extern void MPExit(OSStatus terminationStatus);
-
- extern MPTaskID MPCurrentTaskID(void );
-
- extern void MPYield(void );
-
- extern OSStatus MPCreateQueue(MPQueueID *queue);
-
- extern OSStatus MPDeleteQueue(MPQueueID queue);
-
- extern OSStatus MPNotifyQueue(MPQueueID queue, void *param1, void *param2, void *param3);
-
- extern OSStatus MPWaitOnQueue(MPQueueID queue, void **param1, void **param2, void **param3, Duration timeout);
-
- extern OSStatus MPCreateSemaphore(MPSemaphoreCount maxVal, MPSemaphoreCount initVal, MPSemaphoreID *semaphore);
-
- extern OSStatus MPCreateBinarySemaphore(MPSemaphoreID *semaphore);
-
- extern OSStatus MPWaitOnSemaphore(MPSemaphoreID semaphore, Duration timeout);
-
- extern OSStatus MPSignalSemaphore(MPSemaphoreID semaphore);
-
- extern OSStatus MPDeleteSemaphore(MPSemaphoreID semaphore);
-
- extern OSStatus MPCreateCriticalRegion(MPCriticalRegionID *region);
-
- extern OSStatus MPEnterCriticalRegion(MPCriticalRegionID region, Duration timeout);
-
- extern OSStatus MPExitCriticalRegion(MPCriticalRegionID region);
-
- extern OSStatus MPDeleteCriticalRegion(MPCriticalRegionID region);
-
- extern LogicalAddress MPAllocate(ByteCount size);
-
- extern void MPFree(LogicalAddress block);
-
- extern void MPBlockCopy(LogicalAddress sourcePtr, LogicalAddress destPtr, ByteCount bytes);
-
- #endif
-
- #pragma options align=reset
- #endif /* PRAGMA_ALIGN_SUPPORTED */
-
- #if PRAGMA_IMPORT_SUPPORTED
- #pragma import off
- #endif
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif /* __MULTIPROCESSING__ */
-
-